package pc29;

import java.util.Scanner;

public class J16Ch05cCalcurator {

	public static void main(String[] args) {

		int x;
		int y;
		String c;

		Scanner sc = new Scanner(System.in);
		System.out.println("두 정수와 연산자를 입력해봐");

		x = sc.nextInt();
		y = sc.nextInt();
		c = sc.next();

		J16Cal cal = null;
		J16CalService cs = new J16CalService();

		switch (c) {
		case "+":
			cal = new J16Add();
			cal.setValue(x, y);
			cs.calcurate(cal, "+");
			break;
		case "-":
			cal = new J16Sub();
			cal.setValue(x, y);
			cs.calcurate(cal, "-");
			break;
		case "*":
			cal = new J16Mul();
			cal.setValue(x, y);
			cs.calcurate(cal, "*");
			break;
		case "/":
			cal = new J16Div();
			cal.setValue(x, y);
			cs.calcurate(cal, "/");
			break;
		default:
			break;
		}

	}
}

class J16Cal {

	private int x;
	private int y;

	// 생성자 생략

	public void setValue(int x, int y) {
		this.x = x;
		this.y = y;

	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public String toString() {
		String result = "";
		result += x + "/" + y;
		return result;
	}

}

class J16Add extends J16Cal {

}

class J16Sub extends J16Cal {

}

class J16Mul extends J16Cal {

}

class J16Div extends J16Cal {

}

interface J16CalIService {
	void calcurate(J16Cal c, String type);

}

class J16CalService implements J16CalIService {

	public void calcurate(J16Cal c, String type) {
		int result = 0;
		switch (type) {
		case "+":
			result = c.getX() + c.getY();
			break;
		case "-":
			result = c.getX() - c.getY();
			break;
		case "*":
			result = c.getX() * c.getY();
			break;
		case "/":
			result = c.getX() / c.getY();
			break;
		}
		System.out.println(result);

	}

}
